<?php slot('header')?>

<style type="text/css">
<!-- 
div.box-content-main table.table-list td.number{
	width: 100px;
}
-->
</style>
<script type="text/javascript">
	$(function(){
		$('a.hz-get-fancy').unbind('click').click(function(){
			if(LOADING.isLoading) return false;
			LOADING.show();
			var $ob = $(this);
			$.fancybox.open({
				href : $ob.attr('data-url'),
				type : 'iframe',
				padding : 7,
				title: '',
				width: 600,
				helpers: {
					overlay:{
						closeClick : false
					} 
				}	
			});
			LOADING.hide();
			//$ob.parent().parent().removeClass('enable-1');
			//$ob.parent().parent().addClass('enable-0');
		});
	});
</script>
<?php end_slot()?>
<div class="box-navigation">
	<?php echo $data['navigation']?>
</div>
<div class="clr"></div>
<?php include_component('default', 'error');?>
<div class="clr"></div>
<div class="box-filter">
	<form action="<?php echo $data['filter_action']?>" method="get" name="filter_form" id="filter-form">
		<select name="filter[filter_is_viewed]" id="filter-is-viewed" class="combo-box hz-selected" data-selected="<?php echo $data['filter']['filter_is_viewed']?>">
			<option value="-1"><?php echo __('select-option-all')?></option>
			<option value="0"><?php echo __('is-viewed-'.ProductComments::IS_VIEWED_NOT)?></option>
			<option value="1"><?php echo __('is-viewed-'.ProductComments::IS_VIEWED)?></option>
		</select>
		<select name="filter[filter_is_allowed]" id="filter-is-allowed" class="combo-box hz-selected" data-selected="<?php echo $data['filter']['filter_is_allowed']?>">
			<option value="-1"><?php echo __('select-option-all')?></option>
			<option value="0"><?php echo __('is-allowed-'.ProductComments::IS_ALLOWED_NOT)?></option>
			<option value="1"><?php echo __('is-allowed-'.ProductComments::IS_ALLOWED)?></option>
		</select>
		<select name="filter[filter_product_id]" id="filter-product-id" class="combo-box hz-selected" data-selected="<?php echo $data['filter']['filter_product_id']?>">
			<option value="-1"><?php echo __('select-option-all')?></option>
			<?php foreach ($data['filter']['products'] as $al):?>
			<option value="<?php echo $al['id']?>"><?php echo $al['name']?></option>
			<?php endforeach?>
		</select>
		<input type="text" placeholder="<?php echo __('filter-sample')?>" maxlength="255" name="filter[filter_key]" id="filter-key" value="<?php echo $data['filter']['filter_key']?>"/>
		<input type="button" name="filter[filter_submit]" id="filter_submit" class="button hz-filter-submit" data-form-id="filter-form" data-keysearch-id="filter-key" value="<?php echo __('filter-submit')?>"/>
	</form>
</div>
<div class="clr"></div>
<div class="box-content">
	<form action="<?php echo $data['filter_action']?>" method="post" name="form_main" id="form-main">
		<input type="hidden" value="none" name="action_name" id="action-name"/>
		<div class="control">
			<a href="#" class="hz-control delete" data-action="<?php echo ADMIN_DEFINED::DELETE_RECORD?>" hz-require="selected" hz-confirm="confirm" data-confirm="<?php echo __('confirm-delete')?>"><?php echo __('control-delete')?></a>
			<a href="#" class="hz-control enable" data-action="<?php echo ADMIN_DEFINED::ENABLE?>" hz-require="selected"><?php echo __('control-enable')?></a>
			<a href="#" class="hz-control disable" data-action="<?php echo ADMIN_DEFINED::DISABLE?>" hz-require="selected"><?php echo __('control-disable')?></a>
			
		</div>
		<div class="clr"></div>
		<div class="box-content-main">
			<table class="table-list" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td class="head checkbox-select"><input type="checkbox" name="select_checkall" id="select-checkall" title="<?php echo __('to-checkall')?>" class="chk-select chk-checkall"/></td>
					<td class="head title"><?php echo __('product-comment-product-name')?></td>
					<td class="head title"><?php echo __('product-comment-full-name')?></td>
					<td class="head title"><?php echo __('product-comment-rating')?></td>
					<td class="head updated-at"><?php echo __('updated-at')?></td>
					<td class="head action"><?php echo __('list-action')?></td>
				</tr>
				<?php 
				$count_for = 0;
				foreach($data['list'] as $val):
				$product = Products::getByIdForDisplay($val['product_id']);
				
				?>
				<tr class="class<?php echo ++$count_for%2?> enable-<?php echo intval($val['is_allowed'])?'1':'0'?>">
					<td class="checkbox-select"><input type="checkbox" name="select_list[]" class="checkbox-select" value="<?php echo $val['id']?>" id="select_<?php echo $val['id']?>" title="<?php echo __('to-check')?>" /></td>
					<td class="title">
						<a href="#" class="hz-get-fancy" data-url="<?php echo sfConfig::get('app_prefix').url_for2('products_comment_view',array('id'=>$val['id']))?>"  title="<?php echo __('product-comment-to-view')?>" alt="<?php echo __('product-comment-to-view')?>">
							<?php echo $product['name']?>
						</a>	
					</td>
					<td class="title">
						<?php echo $val['full_name']?>
						</a>	
					</td>
					<td class="title">
							<?php echo $val['rating_point']?>
							
					</td>
					
					<td class="updated-at"><?php echo DateHelper::dateFormat($val['created_at'])?></td>
					<td class="action">
						<a href="#" class="hz-get-fancy" data-url="<?php echo sfConfig::get('app_prefix').url_for2('products_comment_view',array('id'=>$val['id']))?>" title="<?php echo __('product-comment-to-view')?>" alt="<?php echo __('product-comment-to-view')?>"><img src="/css/admin/img/global/edit.png"/></a>
					</td>
				</tr>
				<?php endforeach;?>
			</table>
		</div>
		<div class="clr"></div>
		<div class="control">
			<a href="#" class="hz-control delete" data-action="<?php echo ADMIN_DEFINED::DELETE_RECORD?>" hz-require="selected" hz-confirm="confirm" data-confirm="<?php echo __('confirm-delete')?>"><?php echo __('control-delete')?></a>
			<a href="#" class="hz-control enable" data-action="<?php echo ADMIN_DEFINED::ENABLE?>" hz-require="selected"><?php echo __('control-enable')?></a>
			<a href="#" class="hz-control disable" data-action="<?php echo ADMIN_DEFINED::DISABLE?>" hz-require="selected"><?php echo __('control-disable')?></a>
		</div>
		<?php if(count($data['pagination_pager'])>1):?>
		<div class="pagination">
			<span><?php echo __('pagination-text')?></span>
			<span class="pagination"> 
			<?php foreach ($data['pagination_pager'] as $p):?>
				<a href="<?php echo empty($p['url'])?'#':($data['app_prefix'].$p['url'])?>" class="<?php echo $p['page_class']?>"><?php echo $p['page_num']?></a>
			<?php endforeach;?>
			</span>
			<div class="clr"></div>
		</div>
		<?php endif;?>
		<div class="clr"></div>
	</form>
</div>